package com.wanwen.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wanwen.entity.Visit;
import com.wanwen.mapper.VisitMapper;
import com.wanwen.utils.Result;

@RestController
@RequestMapping("/visit")
public class VisitController {
	@Autowired
	private VisitMapper visitMapper;
	/**
	 * /visit/add
	 * 添加学生
	 * @param visit
	 * @return rs
	 * */
	@RequestMapping("/add")
	public Object add(Visit visit) {
		Result rs = new Result(visit.getId()+"", "", visitMapper.insert(visit)==1?true:false);
		return rs;
	}
	/**
	 * /visit/update
	 * 修改学生
	 * @param visit
	 * @return rs
	 * */
	@RequestMapping("/update")
	public Object update(Visit visit) {
		Result rs = new Result(visit.getId()+"", "", visitMapper.updateById(visit)==1?true:false);
		return rs;
	}
	/**
	 * /visit/del
	 * 删除学生
	 * @param visit
	 * @return rs
	 * */
	@RequestMapping("/del")
	public Object del(Visit visit) {
		Result rs = new Result(visit.getId()+"", "", visitMapper.deleteById(visit)==1?true:false);
		return rs;
	}
}
